<%@page import="com.alibaba.dubbo.demo.bean.SysDeptInfo"%>
<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<div class="pageContent">
<%
		SysDeptInfo deptInfo = new SysDeptInfo();
		if (request.getSession().getAttribute("sysDeptInfo") != null) {
			deptInfo = (SysDeptInfo) request.getSession().getAttribute("sysDeptInfo");
		}
		String action = "edit";
		if(request.getParameter("action")!=null)
			action = request.getParameter("action");
		String option = "./saveDeptInfo",deptid="",upperid="";
		String upperReadonly ="";
		if(action.equals("edit")) 
		{
			 option = "./updateDeptInfo";
			 deptid = deptInfo.getDeptid().toString();
			 upperid = deptInfo.getUpperid().toString();
			 upperReadonly = "readonly=\"readonly\"";
		}
		else
		{
			deptInfo.setDeptname("");
			deptInfo.setManager("");
			deptInfo.setPhone("");
			deptInfo.setRemark("");
			upperid = "0";
		}
%> 				
<script language="JavaScript">
	function show(type)
	{
		if(type=='edit')
		{
			$("#btnLookup").hide();
			$("#idhint").hide();
			$("#orgLookupdeptid").width(206);
		}
		else
		{
			$("#btnLookup").show();
			$("#idhint").show();
			$("#orgLookupdeptid").width(50);
		}
	}
	show('<%=action%>');
</script>
	<form method="post" action="<%=option%>" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
		<div class="pageFormContent" layoutH="56">
			<p>
				<label>部门ID：</label>
				<input name="deptid" type="text" size="30" value="<%=deptid%>" readonly="readonly" alt="不必输入"/>
			</p>
			<p>
				<label>部门名称：</label>
				<input name="deptname" class="required" type="text" size="30" value="<%=deptInfo.getDeptname()%>" alt="请输入部门名称"/>
			</p>
			<p>
				<label>上级部门ID：</label>
				<input id="orgLookupdeptid" type="text" name="orgLookup.deptid"  width="30px" class="required" value="<%=upperid%>" alt="请输入上级部门ID,顶级部门输0"/> <label id="idhint">顶级部门输入0</label>
				<input type="hidden" name="orgLookup.deptname" value=""  width="12px" suggestFields="deptid,deptname"  suggestUrl="./jsonQueryDeptInfoLookup" lookupGroup="orgLookup" />
				<a  id="btnLookup" class="btnLook" href="./webQueryDeptInfoLookup?all=0" lookupGroup="orgLookup" <%=upperReadonly%>>选择部门</a>
			</p>
			<p>
				<label>部门主管：</label>
				<input name="manager" class="required" type="text" size="30" value="<%=deptInfo.getManager()%>" alt="请输入部门主管"/>
			</p>
			<p>
				<label>电话：</label>
				<input name="phone" type="text" size="30" value="<%=deptInfo.getPhone()%>" />
			</p>
			<p>
				<label>备注：</label>
				<input name="remark" type="text" size="30" value="<%=deptInfo.getRemark()%>" />
			</p>
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>
	</form>
</div>
